package com.web44.ssm.service.impl;

import com.web44.ssm.bean.Adminuser;
import com.web44.ssm.bean.AdminuserExample;
import com.web44.ssm.mapper.AdminuserMapper;
import com.web44.ssm.service.IAdminuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Title: AdminuserService
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/2/18 11:02
 */
@Service
@Transactional
public class AdminuserService implements IAdminuserService {

    @Autowired
    private AdminuserMapper adminuserMapper;


    @Override
    public Adminuser queryAdminuserByUsername(String username) {

        AdminuserExample example = new AdminuserExample();
        example.createCriteria().andUsernameEqualTo(username);
        List<Adminuser> adminusers = adminuserMapper.selectByExample(example);

        if (adminusers == null || adminusers.isEmpty()) {
            return null;
        }
        return adminusers.get(0);
    }
}
